How do I find the index of an undefined string in a List

Using a compiler-generated closure via an anonymous method or lambda is a good way to use a custom value in a predicate expression.

Using a compiler-generated closure via an anonymous method or lambda is a good way to use a custom value in a predicate expression. Private static void findMyString(string str) { List list = new List {"Box", "Gate", "Car"}; int boxId = list. FindIndex(s => s == str); } If you're using .

NET 2.0 (no lambda), this will work as well: private static void findMyString(string str) { List list = new List {"Box", "Gate", "Car"}; int boxId = list. FindIndex(delegate (string s) { return s == str; }); }.

Beautiful mate, thanks! Looking forward to my 3.0 upgrade so I can use those lambdas. – ChristianLinnell Jun 12 '09 at 4:36.

String toLookFor = passedInString; int boxId = list. FindIndex(new Predicate((s) => (s == toLookFor))).

You can just do string item = "Car"; ... int itemId = list. FindIndex(a=>a == item).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.